package cn.getech.data.development.model.vo;

import cn.getech.data.intelligence.common.utils.PageBean;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import jodd.util.StringUtil;
import lombok.Data;

import java.io.Serializable;
import java.util.Arrays;
import java.util.List;

@Data
@ApiModel(value = "告警信息")
public class AlarmSearchVO extends PageBean implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("记录id")
    private Integer id;

    private List<Integer> alarmIds;

    @ApiModelProperty("告警名称")
    private String name;

    @ApiModelProperty("创建人")
    private String createPer;

    @ApiModelProperty("接收人")
    private String receivedPer;

    @ApiModelProperty("接收人")
    private List<String> receivedPerList;

    @ApiModelProperty("触发条件")
    private Integer triggerCondition;

    @ApiModelProperty(value = "用户id",name = "userId")
    private Long userId;

    private Integer tenantId;

    @ApiModelProperty(value = "用户名集合",name = "userIdList",required = false)
    private List<Long> userIdList;

    @ApiModelProperty("接收人id")
    private Integer receiveUserId;

    @ApiModelProperty("创建人id")
    private Integer createUserId;

    @ApiModelProperty("重试发送次数，1，发送一次 2，每次重试都发送")
    private Integer failStatus;

    public List<String> getReceivedPerList(){
        List<String> result = null;
        if (StringUtil.isNotBlank(receivedPer)) {
            result = Arrays.asList(receivedPer.split(","));
        }
        return result;
    }

}
